function bsp4_1

X=[1 1 1 1;0 0 1 1;0 1 0 1]; % Koordinaten und Bias Vektor

% Initialisieren der Klassenzugehoerigkeit
and = [-1 -1 -1 1];
or = [-1 1 1 1];
xor = [-1 1 1 -1];

% Perceptron Training fuer Funktion AND
w = perco(X, and, 100);
plot(X(2,(and == -1)), X(3,(and == -1)), 'r.');
hold on;
plot(X(2,(and == 1)), X(3,(and == 1)), 'b.'); 
hold on;
axis([-1 2 -1 2]);
plot([-1 2],[(w(1)+w(2)*-1)/-w(3) (w(1)+w(2)*2)/-w(3)],'g-');

% Perceptron Training fuer Funktion OR
w = perco(X, or, 100);
figure;
plot(X(2,(or == -1)), X(3,(or == -1)), 'r.');
hold on;
plot(X(2,(or == 1)), X(3,(or == 1)), 'b.'); 
hold on;
axis([-1 2 -1 2]);
plot([-1 2],[(w(1)+w(2)*-1)/-w(3) (w(1)+w(2)*2)/-w(3)],'g-');

% Perceptron Training fuer Funktion XOR
w = perco(X, xor, 100);
figure;
plot(X(2,(xor == -1)), X(3,(xor == -1)), 'r.');
hold on;
plot(X(2,(xor == 1)), X(3,(xor == 1)), 'b.'); 
hold on;
axis([-1 2 -1 2]);
plot([-1 2],[(w(1)+w(2)*-1)/-w(3) (w(1)+w(2)*2)/-w(3)],'g-');